import path from "path"
import resret from "../../commonPort/resret"
import isuser from "../../commonPort/isuser"
import {readFlie} from "../../../../fs_file包封装/node_modules/fs_file"
export default function login(req,res) { //登录验证
           //获取请求栏信息对象
           console.log("封装的login方法执行了");
           let {callback,user,pass} =  req.query
        //    let query = req.query
        //    let user = query.user
        //    let pass = query.pass
   
           let arr = JSON.parse(readFlie(path.join(__dirname, "../json/name.json")))
           //判断并响应
           let text = isuser(user, pass, arr) === 1 ? "001" : isuser(user, pass, arr) === 2 ? "002" : "003"
           resret({
            res,
            callback,
            text: JSON.stringify(arr)
        })
           return true;
}